#include "itemmodel.h"
#include <QDebug>

SimpleItemModel::SimpleItemModel(SimpleItemModel::CountFun count, SimpleItemModel::DataFun data)
    :count_fun_(count)
    ,data_fun_(data)
{
}

quint32 SimpleItemModel::count() const
{
    if(count_fun_){
        return count_fun_();
    }else{
        qWarning() << Q_FUNC_INFO << "Empty data function!";
        return 0;
    }
}

QString SimpleItemModel::data(int row) const
{
    if(data_fun_){
        return data_fun_(row);
    }else{
        qWarning() << Q_FUNC_INFO << "Empty data function!";
        return "";
    }
}
